package com.ruoyi.api.event;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

/**
 * 默认事件发布器实现
 */
@Service
@Primary
public class DefaultEventPublisher implements EventPublisher {
    
    private static final Logger logger = LoggerFactory.getLogger(DefaultEventPublisher.class);
    
    @Autowired
    private EventCenter eventCenter;
    
    @Override
    public void publishEvent(OrderExecutionEvent event) {
        logger.info("Publishing order event: {}", event.getEventType());
        eventCenter.publishEvent(event);
    }
    
    @Override
    public void publishEvent(TransactionEvent event) {
        logger.info("Publishing transaction event: {}", event.getEventType());
        eventCenter.publishEvent(event);
    }
} 